package org.wattdepot.cli.processor;

import java.util.List;
import org.wattdepot.cli.command.WattFuelTypes;

/**
 * Parses the fueltypes command.
 * 
 * @author Kendyll Doi
 * @author Kimberly Heu
 *
 */
public class FuelTypesCommand extends CommandLineInterface implements WattDepotCliCommand {

  /**
   * Parses the fueltypes command.
   * 
   * @param args The user's inputted arguments
   * @return The string containing the results from executing the command.
   */
  public String doCommand (List<String> args) {
    StringBuffer buf = new StringBuffer(2000); // StringBuffer for output
    String output = ""; // String for text to be returned
    
    // Check the number of arguments in the command to ensure there are exactly two
    if (args.size() == 2) {
      buf.append(WattFuelTypes.wattFuelTypes(args.get(1), client));
    }
    else {
      // Return an error message if there are an incorrect number of arguments
      buf.append("Incorrect number of arguments for fueltypes command.");
    }
    
    // Convert buffer contents to String and return
    output = buf.toString();
    return output;
  }
}
